#pragma once

struct CalcDesc
{
	bool				m_enabled;
	uint		m_flags;
	uint		m_nextIteration; // ms

	CalcDesc() :
		m_enabled(false),
		m_flags(0),
		m_nextIteration(0)
	{}

	CalcDesc(bool enabled, uint flag) :
		m_enabled(enabled),
		m_flags(flag),
		m_nextIteration(0)
	{}

	CalcDesc(bool enabled, uint flag, uint nextIteration) :
		m_enabled(enabled),
		m_flags(flag),
		m_nextIteration(nextIteration)
	{}
};

/*--------------------------------------------------------------------------*/

#define ICALC_MAX_TASKS_NUM 4

class ICalc
{
public:
	ICalc();
	virtual ~ICalc();

	/*--------------------------------------------------------------------------*/
	virtual void	OnPreCalc(uint arg);
	virtual void	OnCalc(uint arg) = 0;
	virtual void	OnPostCalc(uint arg);

	/*--------------------------------------------------------------------------*/

	void			SetCalcFlag(uint arg, uint type);
	uint			GetCalcFlag(uint arg) const;

	void			StartTask(uint arg, const CalcDesc& calcDesc);
	void			StopTask(uint arg);
	CalcDesc*		GetTaskByArg(uint arg);

	void			DoCalc(uint arg);
	void			AddTaskToCurrentQueue(uint arg);

private:
	CalcDesc		m_calcargs[ICALC_MAX_TASKS_NUM];
};